#ifndef __DFS_INNER_H_
#define __DFS_INNER_H_

#ifdef __cplusplus
extern "C"
{
#endif


#include "dfs_config.h"
#include "dfs_file.h"
#include "dfs_fs.h"
#include "loger.h"


#ifndef O_DIRECTORY
#define	O_DIRECTORY	0x200000
#endif

/* inner func */

void dfs_lock(void);
void dfs_unlock(void);

void dfs_set_errno(int err);
struct dfs_filesystem *dfs_get_fs_tbl(uint32_t idx);
const struct dfs_filesystem_ops *dfs_get_fs_ops_tbl(uint32_t idx);
void dfs_set_fs_ops_tbl(uint32_t idx, const struct dfs_filesystem_ops *ops);

const char *dfs_subdir(const char *directory, const char *filename);
char *dfs_normalize_path(const char *directory, const char *filename);
char *dfs_get_working_dir(void);
int dfs_fd_is_open(const char *pathname);

/* 内存管理 */
void dfs_mem_free(void *ptr);
void *dfs_mem_malloc(unsigned int bytes);
void *dfs_mem_realloc(void *ptr, unsigned int bytes);
void *dfs_mem_calloc(size_t cnt, size_t bytes);
char *dfs_mem_strdup(const char *s);


#ifdef __cplusplus
}
#endif

#endif // __DFS_INNER_H_
